<template>
	<view class="chatList">
		<ChatItem 
			v-for="(item, i) in chatList" 
			:key="i"
			:isLeft="item.userId != user_id"
			:nickname="item.nickName"
			:message="item.message"
			:icon="IP + item.icon"
		></ChatItem>
	</view>
</template>

<script>
	import ChatItem from '../ChatItem/ChatItem.vue'
	import {IP} from '../../network/requestUrl.js'
	export default {
		components: {
			ChatItem
		},
		props: {
			chatList: {
				type: Array,
				default: () => []
			}
		},
		data() {
			return {
				user_id: '',
				IP
			};
		},
		created(){
			this.user_id = this.$store.state.userInfo.user_id
			// console.log(this.user_id)
		}
	}
</script>

<style lang="scss">
.chatList{
	padding-bottom: 10rpx;
}
</style>
